<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.Constants,org.apache.struts.util.LabelValueBean" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); %>
<%
    String productId     = request.getParameter("baseProductId");

    if( productId == null || ( productId != null && productId.trim().length() == 0 ) )
    {
        productId = "0";
    }
%>

<html>
    <HEAD>
        <TITLE>Scalarsoft - ChipTrac</TITLE>
        <META http-equiv=Content-Type content="text/html; charset=windows-1252">
        <LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
    </HEAD>
    <BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" >
    <script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
    <script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
    <SCRIPT language="JavaScript">

    function loadPartNumbers()
    {
        var baseProductId = document.vendorInventoryForm.baseProductId.options[document.vendorInventoryForm.baseProductId.selectedIndex].value;
        document.vendorInventoryForm.action ="<%=chipTracContext%>/vendorInventoryReport.do?reporttype=vendorinventoryreport&baseProductId="+ baseProductId;
        document.vendorInventoryForm.submit();
    }

    function submitPage()
    {
		var d = new Date();
		var day = d.getDate();
		var month = d.getMonth()+1;
		var year = d.getFullYear();
		var hour = d.getHours();
		var min = d.getMinutes();
		var sec = d.getSeconds();
        var form = document.vendorInventoryForm;
		var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
		var reporttype        = "";
        var errorObj =  document.getElementById("errors")
        errorObj.innerHTML = '';

        form.prompt0.value  = '0';
        form.prompt1.value  = form.partNumber.options[form.partNumber.selectedIndex].value;
		form.prompt2.value  = form.vendorName.value;
		form.prompt3.value  = defaultPrompt;
		form.prompt4.value  = '';
		form.prompt5.value  = '';
		form.prompt6.value  = '';
		form.prompt7.value  = '';
		form.prompt8.value  = '';
		form.prompt9.value  = '';
		form.prompt10.value = '';

		form.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Operations/Vendor_Inventory_Report.rpt";
    }

    </script>
    <!-- Top Header Start-->
   <%@include file="/jsp/includes/extHeader.jsp"  %>
    <!-- Top Header End-->
    <TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
      <TBODY >
      <TR>
        <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

        <!-- Side Navigation start -->
        <%@ include file="/jsp/admin/externaluser_menu.jsp" %></TD>
        <!-- end of the side navigations -->

        <TD bgcolor="#ffffff">
        <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">

        <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
        <BR>
        <!-- from here your body starts -->
        <form name="vendorInventoryForm" method="post">
        <input type="hidden" name="prompt0">
        <input type="hidden" name="prompt1">
        <input type="hidden" name="prompt2">
        <input type="hidden" name="prompt3">
        <input type="hidden" name="prompt4">
        <input type="hidden" name="prompt5">
        <input type="hidden" name="prompt6">
        <input type="hidden" name="prompt7">
        <input type="hidden" name="prompt8">
        <input type="hidden" name="prompt9">
        <input type="hidden" name="prompt10">
        <input type="hidden" name="vendorName" value="<%= request.getAttribute("vendorName") %>">

        <TABLE width='75%' align=center cellpadding='3' cellspacing='2' border='0' bordercolor='black'>
            <TR><Td colspan='4' class="NArialW" align=center>Vendor Inventory Report</td></tr>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <tr><td colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></td></tr>
            <tr>
                <td width="5%" class="NArialL"><%--Base Product--%>&nbsp;</td>
                <td width="10%" class="NArialL">
                    <%--<select name="baseProductId" class="txfield" onchange="javascript:loadPartNumbers()">
                        <option value="0">All Base Products</option>
                        <logic:iterate id="baseProductList"  name="basePartNumberList" >
                            <logic:equal name="baseProductList" property="value" value="<%=productId%>"><option value="<bean:write name="baseProductList" property="value"/>" selected><bean:write name="baseProductList" property="label"/></option></logic:equal>
                            <logic:notEqual name="baseProductList" property="value" value="<%=productId%>"><option value="<bean:write name="baseProductList" property="value"/>"><bean:write name="baseProductList" property="label"/></option></logic:notEqual>
                        </logic:iterate>
                     </select>--%>
                     &nbsp;
                </td>
                <td width="15%" class="NArialL">Part Number</td>
                <td width="55%" class="NArialL">
                    <select name="partNumber" class="emptyList" >
                        <option value="0">All Part Number</option>
                        <logic:present name="partNumberList">
                        <logic:iterate id="partNumberList"  name="partNumberList" >
                            <option value="<bean:write name="partNumberList" property="value"/>"><bean:write name="partNumberList" property="label"/></option>
                        </logic:iterate>
                        </logic:present>
                     </select>
                </td>
            </tr>
            </tr>
            <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
            <tr>
                <td width="70%" colspan=5 align="center">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="image" onClick="javascript:return submitPage();"  border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17" onmouseover="window.status='Click to Generate Report';return true"onmouseout="window.status='';return true"title="Click here to Generate Report">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="javascript:document.vendorInventoryForm.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true"title="Click here to Reset"></a>
                </td>
            </tr>
     </table>
     </form>
     <!-- till here -->
     <BR><BR>
     </TD><TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD></TR>
     </TABLE>
     <!-- Footer starts here -->
     <%@ include file="/jsp/includes/footer.jsp" %>
     <!-- footer end here -->
    </body>
</html>

